<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>Document</title>
	</head>
	<body>
	     <input type="type" id="year">
	     <input type="button" value="按钮" -onclick="var yearInput = document.getElementById('year'); alert(yearInput.value);" id="btn">
		
	</body>
</html>
<script> 
	var yearInput = document.getElementById("year");
	var btn = document.getElementById("btn");
	btn.onclick = function() {
        var year = yearInput.value;
        if (!year) {
        	return alert("不能为空");
        }
        var num = year - 0;
        if (num != num){
        	return alert("对不起，您输入的不是数字");
        } 
        if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
        	alert("闰年");
        }else {
        	alert("平年");
        }
	};

</script>
